<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        
        var age=10;
        function say(){//1001
            var age=20;
            console.log(this.age);
        }

        var o={
            age:30,
            say:say,//1001
            getSay:function(fn){//fn:1001
                fn()//->window
            },
            sayHello:function(){
                // console.log(this.age);//30
                return function(){
                 return this.age   
                }
            }
        }
        //1.say()
        // say();//->window 10
        //2.o.say()
        // o.say();//->o 30
        //3.o.getSay()
        o.getSay(say);//->window 10
        //4.o.sayHello()
        // o.sayHello();//->o 30
        //5.o.sayHello()()
       console.log( o.sayHello()());//->window 10






        // function say(){
        //     return function(){
        //         console.log("hello");
        //     }
        // }
        // var a=say();
        // a();
        // function say(){//1001
        //     console.log(this);//指向window
        // }
        // function getSay(fn){//fn:1001
        //     fn();
        // }
        // getSay(say);
    </script>
</head>
<body>
    
</body>
</html>